/**
 * Created with JetBrains WebStorm.
 * User: Administrator
 * Date: 13-6-8
 * Time: 下午4:18
 * To change this template use File | Settings | File Templates.
 */
Ext.define('cloud.controller.ProductAssess', {
    extend: 'Ext.app.Controller',
    requires: ['Ext.picker.Picker'],
    config: {
        refs: {
            productassess: 'productassess',
            productassess_search: 'productassess #productassess_search',
            productassess_select: 'productassess #productassess_select'
        },
        control: {
            productassess_select: {
                change: function (item, newValue, oldValue) {
                    switch (newValue) {
                        case 'cpid':
                            this.choose = 'cpid';
                            break;
                        case 'cuid':
                            this.choose = 'cuid';
                            break;
                    }

                }
            },
            /**
             * search productassess
             */
            productassess_search: {
                change: function () {
                    var value = this.getProductassess_search().getValue();
                    var Store = Ext.getStore('ProductAssessAreaFindStore');
                    Store.clearFilter();
                    if (value != "") {
                      Store.filter('cuname', value, true);
                     }
                    Store.load({params: {cadid: localStorage.getItem('cadid')}});
                }

            }
        }
    },
    choose: 'cuid'
});
